package org.jeecg.modules.flowable.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.flowable.apithird.entity.SysCategory;
import org.jeecg.modules.flowable.apithird.service.IFlowThirdService;

import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.mapper.SysRoleMapper;
import org.jeecg.modules.system.mapper.SysUserMapper;
import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
import org.jeecg.modules.system.service.impl.SysUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FlowThirdServiceImpl implements IFlowThirdService {
    @Autowired
    SysUserServiceImpl sysUserService;
    @Resource
    private SysRoleMapper roleMapper;
    @Resource
    private SysUserMapper userMapper;
    @Override
    public SysUser getLoginUser() {
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = loginUser.getId();
        return   sysUserService.getUserById(userId);
    }

    @Override
    public List<SysUser> getAllUser() {
        return sysUserService.getAllUser();
    }

    @Override
    public List<SysUser> getUsersByRoleId(String roleId) {
        return null;
    }

    @Override
    public SysUser getUserByUsername(String username) {

        return  userMapper.getUserByName(username);
    }

    @Override
    public SysUser getUserByUserId(String userId) {
        return userMapper.getUserById(userId);
    }

    @Override
    public List<SysRole> getAllRole() {
        return roleMapper.selectList(new QueryWrapper<SysRole>());
    }

    @Override
    public List<SysCategory> getAllCategory() {
        return null;
    }

    @Override
    public List<String> getDepartNamesByUsername(String username) {
        return null;
    }
}
